package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.lmx.repoDomain.tmodel.business.User;

import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 薪资月统计
 * @author Jason
 *
 */
@JsonApiResource(type = "salaryreport")
@Table(name = "tnb_salary_report")
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class SalaryReport extends BaseEntity {

	private User lastUpdateUser;// 更新操作者userid

	private Integer createDateTime;	// 创建时间
	
	private User createUser;
	
	private Integer payOffCount = 0;	// 开支人数
	
	private Integer dimissionCount = 0;	// 离职人数
	
	private Integer entryCount = 0;	// 新入职人数

	private Integer lastUpdateDateTime;// 更新时间
	
	private String remark;// 备注
	
	private Integer year;	// 工资年份
	
	private Integer month;	// 工资月份
	
	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	@Column(name = "lastUpdateDateTime")
	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "createuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "lastupdateuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getLastUpdateUser() {
		return lastUpdateUser;
	}

	public void setLastUpdateUser(User lastUpdateUser) {
		this.lastUpdateUser = lastUpdateUser;
	}


	public SalaryReport() {
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Integer getPayOffCount() {
		return payOffCount;
	}

	@Column(name="payOffCount", columnDefinition="int default 0", nullable=false)
	public void setPayOffCount(Integer payOffCount) {
		this.payOffCount = payOffCount;
	}

	public Integer getDimissionCount() {
		return dimissionCount;
	}

	@Column(name="dimissionCount", columnDefinition="int default 0", nullable=false)
	public void setDimissionCount(Integer dimissionCount) {
		this.dimissionCount = dimissionCount;
	}

	public Integer getEntryCount() {
		return entryCount;
	}

	@Column(name="entryCount", columnDefinition="int default 0", nullable=false)
	public void setEntryCount(Integer entryCount) {
		this.entryCount = entryCount;
	}

	public Integer getYear() {
		return year;
	}

	public void setYear(Integer year) {
		this.year = year;
	}

	public Integer getMonth() {
		return month;
	}

	public void setMonth(Integer month) {
		this.month = month;
	}

}
